<?php

/**
 * 转赠
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 16/9/20
 * Time: 下午9:47
 */
class Donation extends MY_Api_Controller
{
    public function index()
    {
        $uid          = $this->uid;
        $to_uid       = (int)$this->input->get_post('to_uid');
        $amount       = (double)$this->input->get_post('amount');
        $notice       = trim($this->input->get_post('notice'));
        $pay_password = trim($this->input->get_post('pay_password'));


        $this->load->service('finance/service_finance_donation');
        $data = $this->service_finance_donation->index($uid, $to_uid, $amount, $pay_password, $notice);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 选择要转赠的人
     */
    public function choice()
    {
        $uid     = $this->uid;
        $keyword = trim($this->input->get_post('keyword'));
        $page    = (int)$this->input->get_post('page');
        $limit   = (int)$this->input->get_post('limit');


        $this->load->service('finance/service_finance_donation');
        $data = $this->service_finance_donation->choice($uid, $keyword, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }
}